package com.yjz.jvm.juc;

import com.yjz.springlearn.ioclearn.Card;
import org.junit.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class HashMapTest {
  @Test
  public void test() {
    Card card = new Card();
    card.setCardName("招商银行信用卡");
    card.setCardNo("888888888");
//        List list=new ArrayList<>();
//          int i=100000000;
//          for (int j=0;j<i;j++){
//              list.add(new Card());
//          }
//        System.out.println("list大小"+list.size());
    System.out.println(card.hashCode());
    System.out.println(9 ^ 2);
  }

  @Test
  public void test2() {
    String aa = "fd25c3fda0ad4c64bc894c3b0b613cb9c911b8f8e75147ffb05e2cdcf68daa5e";
    System.out.println(aa.getBytes().length);
  }

  @Test
  public void hashMapTest() {
    final Map map = new HashMap();
    Runnable runnable = new Runnable() {
      @Override
      public void run() {
        map.put("张三", "222");
      }
    };
    new Thread(runnable).start();

    try {
      Thread.sleep(600L);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    for (Object o : map.entrySet()) {
      System.out.println(o);
    }
  }


  @Test
  public void hashMapLearn() {

    Map<Integer,String> map = new HashMap<>();
    map.put(1, "a");
    map.put(2, "b");
    map.put(3, "c");
    map.put(4, "d");
    map.put(5, "e");
    map.put(6, "f");
    map.put(7, "g");
    map.put(8, "h");
    map.put(9, "i");
    map.put(10, "j");
    map.put(11, "k");
    map.put(12, "l");
    map.put(13, "m");
    map.put(14, "o");
    map.put(15, "p");
    map.put(16, "q");
    map.put(17, "r");

    map.get("17");
    System.out.println(map);


  }
}
